package com.stedu.mall.orderservice.service;


import com.stedu.mall.common.bean.OrderDetail;
import com.stedu.mall.common.service.GoodsService;
import com.stedu.mall.common.service.OrderDetailService;
import com.stedu.mall.orderservice.mapper.OrderDetailMapper;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderDetailServiceImpl implements OrderDetailService {
    @Autowired
    private OrderDetailMapper orderDetailMapper;
    @DubboReference
    private GoodsService goodsService;
    
    
    @Override
    public List<OrderDetail> selectFive() {
        List<OrderDetail> orderDetails = orderDetailMapper.selectFive();
        for (OrderDetail orderDetail : orderDetails) {
            orderDetail.setGoods(goodsService.selectById(orderDetail.getGoodsId()));
        }
        return orderDetails;
    }
}
